package com.wyyc.common.city.controller;

import com.alibaba.fastjson.JSON;
import com.wyyc.common.city.service.CityService;
import com.wyyc.entity.ResJson;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created by Hwei~ on 2017/6/7.
 */
@Controller
@RequestMapping("request/city/")
public class CityController {

    @Resource
    private CityService cityService;

    @RequestMapping(value = "updCity",method = RequestMethod.POST,produces = "text/html;charset=UTF-8")
    @ResponseBody
    public String updCity(){
        ResJson resJson = cityService.updCity();
        return JSON.toJSONString(resJson);
    }

    @RequestMapping(value = "getCity",method = RequestMethod.POST,produces = "text/html;charset=UTF-8")
    @ResponseBody
    public String getCity(){
        ResJson resJson = cityService.getCityAll();
        return JSON.toJSONString(resJson);
    }
}
